import 'package:flutter/material.dart';
import 'package:hi_flutter/app_page.dart';

class PaintPage extends StatelessWidget {
  const PaintPage({super.key});

  @override
  Widget build(BuildContext context) {
    return AppPage(
      body: CustomPaint(
        painter: MyCanvasPainter(),
      ),
    );
  }
}

class MyCanvasPainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    final Paint paint = Paint()..color = Colors.amber;
    canvas.drawCircle(const Offset(100, 200), 40, paint);

    final Paint paintRect = Paint()..color = Colors.lightBlue;
    Rect rect = Rect.fromPoints(const Offset(150, 300), const Offset(300, 400));
    canvas.drawRect(rect, paintRect);
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return false;
  }
}
